******Main File for Results found in Sections 4 and 5, and Appendices D-R******

clear
set more off
set matsize 10000
clear matrix
clear mata
set maxvar 30000
set maxiter 1000

*Set directory to location of replication package
global reploc REPLICATIONPACKAGELOCATION

*Set directory to location of raw IFLS data
global ifls1rawdata IFLS1DATALOCATION
global ifls2rawdata IFLS2DATALOCATION
global ifls3rawdata IFLS3DATALOCATION
global ifls4rawdata IFLS4DATALOCATION
global ifls5rawdata IFLS5DATALOCATION

*Set directory to location of raw MxFLS data
global mxfls1rawdata MxFLS1DATALOCATION
global mxfls2rawdata MxFLS2DATALOCATION
global mxfls3rawdata MxFLS3DATALOCATION

*Install needed packages
ssc install outreg2, replace
ssc install tabout, replace
ssc install shp2dta, replace

* ** Cleaning of Indonesian data * **

*Clean and compile data needed for analysis from IFLS
cd "$reploc/programs"
do clean_ifls.do

* ** Cleaning of Mexican data * **

*Clean and compile data needed for analysis from MxFLS
cd "$reploc/programs"
do clean_mxfls.do

* ** Summary statistics and descriptive graphs * **

*Figure 2 - Indonesia
cd "$reploc/programs"
do figure2_indonesia.do

*Figure 2 - Mexico
cd "$reploc/programs"
do figure2_mexico.do

*Table 3 - Indonesia
cd "$reploc/programs"
do table3_indonesia.do

*Table 3 - Mexico
cd "$reploc/programs"
do table3_mexico.do

*Figure D.1 - Indonesia
cd "$reploc/programs"
do figured1_indonesia.do

*Figure D.1 - Mexico
cd "$reploc/programs"
do figured1_mexico.do

*Figure D.2 - Indonesia
cd "$reploc/programs"
do figured2_indonesia.do

*Figure D.2 - Mexico
cd "$reploc/programs"
do figured2_mexico.do

*Figure E.1
cd "$reploc/programs"
do figuree1.do

*Figure E.2
cd "$reploc/programs"
do figuree2.do

*Table E.1 - Indonesia
cd "$reploc/programs"
do tablee1_indonesia.do

*Table E.1 - Mexico
cd "$reploc/programs"
do tablee1_mexico.do

*Table F.1 - Indonesia
cd "$reploc/programs"
do tablef1_indonesia.do

*Table F.1 - Mexico
cd "$reploc/programs"
do tablef1_mexico.do

* ** Main results * **

*Table 1 - Indonesia
cd "$reploc/programs"
do table1_indonesia.do

*Table 1 - Mexico
cd "$reploc/programs"
do table1_mexico.do

*Table 2 - Indonesia
cd "$reploc/programs"
do table2_indonesia.do

*Table 2 - Mexico
cd "$reploc/programs"
do table2_mexico.do

*Figure 3 - Indonesia
cd "$reploc/programs"
do figure3_indonesia.do

*Figure 3 - Mexico
cd "$reploc/programs"
do figure3_mexico.do

*Figure 4
cd "$reploc/programs"
do figure4.do

*Figure 5
cd "$reploc/programs"
do figure5.do

* ** Robustness * **

*Table H.1 & Table H.2 - Indonesia
cd "$reploc/programs"
do tablesh1h2_indonesia.do

*Table H.1 & Table H.2 - Mexico
cd "$reploc/programs"
do tablesh1h2_mexico.do

*Table I.1
cd "$reploc/programs"
do tablei1.do

*Table I.2
cd "$reploc/programs"
do tablei2.do

*Table I.3
cd "$reploc/programs"
do tablei3.do

*Figure J.1 - Indonesia
cd "$reploc/programs"
do figurej1_indonesia.do

*Figure J.1 - Mexico
cd "$reploc/programs"
do figurej1_mexico.do

*Table J.1 - Indonesia
cd "$reploc/programs"
do tablej1_indonesia.do

*Table J.1 - Mexico
cd "$reploc/programs"
do tablej1_mexico.do

*Table K.1 - Indonesia
cd "$reploc/programs"
do tablek1_indonesia.do

*Table K.1 - Mexico
cd "$reploc/programs"
do tablek1_mexico.do

*Table L.1 - Indonesia
cd "$reploc/programs"
do tablel1_indonesia.do

*Table L.1 - Mexico
cd "$reploc/programs"
do tablel1_mexico.do

*Figure M.1 - Indonesia
cd "$reploc/programs"
do figurem1_indonesia.do

*Figure M.1 - Mexico
cd "$reploc/programs"
do figurem1_mexico.do

*Table O.1 - Indonesia
cd "$reploc/programs"
do tableo1_indonesia.do

*Table O.1 - Mexico
cd "$reploc/programs"
do tableo1_mexico.do

*Table P.1 and Table P.2 - Indonesia
cd "$reploc/programs"
do tablesp1p2_indonesia.do

*Table P.1 and Table P.2 - Mexico
cd "$reploc/programs"
do tablesp1p2_mexico.do

*Table Q.1 - Indonesia
cd "$reploc/programs"
do tableq1_indonesia.do

*Table Q.1 - Mexico
cd "$reploc/programs"
do tableq1_mexico.do

*Table R.1 - Indonesia
cd "$reploc/programs"
do tabler1_indonesia.do

*Table R.1 - Mexico
cd "$reploc/programs"
do tabler1_mexico.do
